package com.CST.mapper.cst.ys;

import com.CST.dto.ys.NumAndYardDTO;
import com.CST.dto.ys.YsBusinessBudgetDTO;
import com.CST.entity.ys.YsAccountDetail;
import com.CST.entity.ys.YsModifyRecords;
import com.CST.vo.ys.ExpenseVO;
import com.CST.vo.ys.YsAccountDetailBusinessOrManageVO;
import com.CST.vo.ys.YsModifyRecordVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.mapstruct.Mapper;

import java.util.List;

/**
 * 业务-预算执行管理
 * @author cw
 */
@Mapper
public interface YsBusinessBudgetMapper extends BaseMapper<YsAccountDetail> {
    /**
     * 获取业务-预算执行管理列表
     * @param ysBusinessBudgetDto 查询条件
     * @return result
     */
    List<YsAccountDetailBusinessOrManageVO> selectYsBudgetList(YsBusinessBudgetDTO ysBusinessBudgetDto);

    /**
     * 根据id获取数据详情
     * @param id id
     * @return result
     */
    YsAccountDetailBusinessOrManageVO selectInfoByNum(Integer id);

    /**
     * 删除
     * @param id id
     * @return result
     */
    int deleteByNum(Integer id);

    /**
     * 发布
     * @param resultList 发布数据
     * @return result
     */
    int insertYsAccountDetailRe(List<YsAccountDetailBusinessOrManageVO> resultList);

    /**
     * 删除发布表数据
     * @param ysBusinessBudgetDto 默认不传
     * @return result
     */
    int deleteByDto(YsBusinessBudgetDTO ysBusinessBudgetDto);

    /**
     * 查询修订记录表
     * @param ysBusinessBudgetDto 查询条件
     * @return result
     */
    List<YsModifyRecordVO> selectModifyRecordList(YsBusinessBudgetDTO ysBusinessBudgetDto);

    /**
     * 新增修订记录
     * @param info info
     * @param record 修改记录
     * @return result
     */
    int insertRecord(@Param("info") YsAccountDetailBusinessOrManageVO info, @Param("record") YsModifyRecords record);

    /**
     * 撤销
     * @param dto id+院区+type
     */
    void updateDetailDeleteFlagById(NumAndYardDTO dto);

    /**
     * 查询现有列表中是否存在
     * @param dto 编号+院区
     * @return result
     */
    int selectIsExist(NumAndYardDTO dto);

    /**
     * 删除修订记录数据
     * @param id id
     * @return result
     */
    int DeleteRecordById(Integer id);

    /**
     * 查询表最大ID
     * @return id
     */
    int selectMaxId();

    /**
     * 查询修订记录表中是否存在
     * @param num
     * @param type
     * @return
     */
    int selectRecordIsExist(Integer num,Integer type);

    /**
     * 删除
     * @param ysAccountDetail
     * @return
     */
    int deleteByNumAndDeleteFlag(YsAccountDetail ysAccountDetail);

    /**
     * 查询新增数据是否已经存在
     * @param ysAccountDetail
     * @return
     */
    int selectByYardAndAccountNum(YsAccountDetail ysAccountDetail);

    List<ExpenseVO> selectYsBudgetListCount(YsBusinessBudgetDTO ysBusinessBudgetDto);
}
